import { nodeResolve } from '@rollup/plugin-node-resolve'
import vue from 'rollup-plugin-vue';
import resolve from 'rollup-plugin-node-resolve';
//import scss from 'rollup-plugin-scss'
import postcss from 'rollup-plugin-postcss'
//vue2：rollup-plugin-vue^5.1.9 + vue-template-compiler
//vue3：rollup-plugin-vue^6.0.0 + @vue/compiler-sfc
const file = type => `dist/${name}.js`
const name = 'ygbh';

export { name, file }
export default {
    input: 'src/index.js',
    // output: {
    //     file: "./dist/ygbh.js", // 输出多个文件
    //     globals: {
    //         vue: "Vue" // 告诉rollup全局变量Vue即是vue
    //     }
    // },
    output: {
        name,
        file: file('esm'),
        format: 'es'
    },
    external: ['vue'],
    plugins: [
        nodeResolve(),
        vue({
            compileTemplate: true
        }),
        resolve(),
        postcss(),
    ]
}